package com.h2cloud.Enum;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

/**
 * @author: wulongkai
 * @create: 2022-11-08 15:09
 **/
@AllArgsConstructor
public enum SalaryPackageEnum {


    /**
     * 试用期月薪
     */
    probationMonthlySalary("probationMonthlySalary", "试用期月薪（元/月）"),

    fullMonthlySalary("fullMonthlySalary", "转正后月薪（元/月）"),
    //TODO 候选人 需要确定
    basic("basicN+3", "当前基本工资"),

    daylySalaryForTrainee("daylySalaryForTrainee", "实习生/劳务日薪"),

    yearEndBonusRule("yearEndBonusRule", "年终奖系数与规则"),
    //TODO 待定义
    new2("1", "年终奖标准"),

    yearEndBonusRuleRemark("yearEndBonusRuleRemark", "年终奖其他规则备注"),

    examineCycle("examineCycle", "考核周期"),

    performanceCheckWayAndBase("performanceCheckWayAndBase", "绩效核定方式"),
    //TODO 待定义
    new3("2", "单月奖金基数（元/月）"),
    //TODO 待定义
    new4("3", "绩效底薪基数（新房，元/月）"),

    monthlyPerformanceBase("monthlyPerformanceBase", "月度绩效基数"),

    monthlyBonusBase("monthlyBonusBase", "月度奖金基数"),
    //TODO 待定义
    new5("4", "月奖金比例"),
    /**
     * 原月绩效比例
     */
    monthlyPerformanceRatio("monthlyPerformanceRatio", "月绩效比例"),

    checkWay("checkWay", "考核方式"),

    laborMonthlySalary("laborMonthlySalary", "劳务合同月薪（元/月）");


    @Getter
    private final String key;
    @Getter
    private final String desc;

    /**
     * 获取薪水结构Map
     *
     * @return {@link SalaryPackageEnum}
     */
    public static Map<String, String> convertToMap() {
        Map<String, String> mapResult = new HashMap<>();

        Arrays.stream(SalaryPackageEnum.values()).forEach(globalExceptionEnum -> {
            mapResult.put(globalExceptionEnum.getKey(), globalExceptionEnum.getDesc());
        });

        return mapResult;
    }


    /**
     * 获取薪水结构枚举
     *
     * @param key 关键
     * @return {@link SalaryPackageEnum}
     */
    public static SalaryPackageEnum getSalaryPackage(String key) {
        for (SalaryPackageEnum salaryPackageEnum : SalaryPackageEnum.values()) {
            if (salaryPackageEnum.getKey().equals(key)) {
                return salaryPackageEnum;
            }
        }
        return null;
    }

    /**
     * 获取薪水结构名称
     *
     * @param key 关键
     * @return {@link SalaryPackageEnum}
     */
    public static String getDesc(String key) {
        for (SalaryPackageEnum salaryPackageEnum : SalaryPackageEnum.values()) {
            if (salaryPackageEnum.getKey().equals(key)) {
                return salaryPackageEnum.getDesc();
            }
        }
        return "";
    }

    public static void main(String[] args) {
//        Map<String, String> stringStringMap = SalaryPackageEnum.convertToMap();
//        Set<String> stringSet = stringStringMap.keySet();
//        for (String st : stringSet) {
//            System.out.println(st);
//        }
//        Iterator<Map.Entry<String, String>> iterator = stringStringMap.entrySet().iterator();
//        while (iterator.hasNext()) {
//            Map.Entry<String, String> next = iterator.next();
//            System.out.println(next.getKey() + " " + next.getValue());
//        }

//        Map<Integer, String> map = new HashMap<>();
//        map.put(1, "1");
//        map.put(2, "2");
//        System.out.println(map);
//
//        List<String> lists = new ArrayList<>();
//        lists.add("111");
//        DateFormat dateFormat1 = new SimpleDateFormat("yyyy-MM-dd");
//        Date myDate1 = null;
//        try {
//            myDate1 = dateFormat1.parse("2009-06-01");
//        } catch (ParseException e) {
//            e.printStackTrace();
//        }
//        System.out.println(myDate1);
        System.out.println(false || false && true);

    }


}

